package com.snpic.appaw.module.insure.dal.mysql.cxParty;

import java.util.*;

import com.snpic.appaw.framework.common.pojo.PageResult;
import com.snpic.appaw.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.snpic.appaw.framework.mybatis.core.mapper.BaseMapperX;
import com.snpic.appaw.module.insure.dal.dataobject.cxParty.CxPartyDO;
import org.apache.ibatis.annotations.Mapper;
import com.snpic.appaw.module.insure.controller.app.cxParty.vo.*;

/**
 * 车险出单-投被保人信息 Mapper
 *
 * @author jijun
 */
@Mapper
public interface CxPartyMapper extends BaseMapperX<CxPartyDO> {

    default PageResult<CxPartyDO> selectPage(AppCxPartyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CxPartyDO>()
                .eqIfPresent(CxPartyDO::getSessionid, reqVO.getSessionid())
                .eqIfPresent(CxPartyDO::getOrderNo, reqVO.getOrderNo())
                .likeIfPresent(CxPartyDO::getPhname, reqVO.getPhname())
                .eqIfPresent(CxPartyDO::getPhidtype, reqVO.getPhidtype())
                .eqIfPresent(CxPartyDO::getPhidno, reqVO.getPhidno())
                .eqIfPresent(CxPartyDO::getGender, reqVO.getGender())
                .betweenIfPresent(CxPartyDO::getPhbirthdate, reqVO.getPhbirthdate())
                .eqIfPresent(CxPartyDO::getPhtelephone, reqVO.getPhtelephone())
                .eqIfPresent(CxPartyDO::getPhemail, reqVO.getPhemail())
                .eqIfPresent(CxPartyDO::getPhaddress, reqVO.getPhaddress())
                .betweenIfPresent(CxPartyDO::getPhstartdate, reqVO.getPhstartdate())
                .betweenIfPresent(CxPartyDO::getPhenddate, reqVO.getPhenddate())
                .eqIfPresent(CxPartyDO::getPhnation, reqVO.getPhnation())
                .eqIfPresent(CxPartyDO::getPhissuer, reqVO.getPhissuer())
                .likeIfPresent(CxPartyDO::getInsuredname, reqVO.getInsuredname())
                .eqIfPresent(CxPartyDO::getInsuredgender, reqVO.getInsuredgender())
                .eqIfPresent(CxPartyDO::getInsuredidtype, reqVO.getInsuredidtype())
                .eqIfPresent(CxPartyDO::getInsuredidno, reqVO.getInsuredidno())
                .betweenIfPresent(CxPartyDO::getInsuredbirthdate, reqVO.getInsuredbirthdate())
                .eqIfPresent(CxPartyDO::getInsuredmobile, reqVO.getInsuredmobile())
                .betweenIfPresent(CxPartyDO::getInsuredstartdate, reqVO.getInsuredstartdate())
                .betweenIfPresent(CxPartyDO::getInsuredenddate, reqVO.getInsuredenddate())
                .eqIfPresent(CxPartyDO::getInsurednation, reqVO.getInsurednation())
                .eqIfPresent(CxPartyDO::getInsuredissuer, reqVO.getInsuredissuer())
                .betweenIfPresent(CxPartyDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CxPartyDO::getRemark, reqVO.getRemark())
                .eqIfPresent(CxPartyDO::getOldId, reqVO.getOldId())
                .orderByDesc(CxPartyDO::getId));
    }

}